]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspacesView: Handle reordering of workspaces
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 9 Jul 2019 12:03:22 +0000 (14:03 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 9 Jul 2019 12:41:35 +0000 (14:41 +0200)
MetaWorkspaceManager gained the ability to reorder workspaces, so make
sure to pick up the new order when that happens.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/620

js/ui/workspacesView.js

index 5fd9b15087a603cc80a5278b877a5399a6a8d27f..7aa976ef389aa04b8588560f13f5ff0f6c9165bc 100644 (file)
@@ -101,6 +101,14 @@ var WorkspacesView = class extends WorkspacesViewBase {
         this._updateWorkspacesId =
             workspaceManager.connect('notify::n-workspaces',
                                      this._updateWorkspaces.bind(this));
+        this._reorderWorkspacesId =
+            workspaceManager.connect('workspaces-reordered', () => {
+                this._workspaces.sort((a, b) => {
+                    return a.metaWorkspace.index() - b.metaWorkspace.index();
+                });
+                this._updateWorkspaceActors(false);
+            });
+
 
         this._overviewShownId =
             Main.overview.connect('shown', () => {
@@ -287,6 +295,7 @@ var WorkspacesView = class extends WorkspacesViewBase {
         global.window_manager.disconnect(this._switchWorkspaceNotifyId);
         let workspaceManager = global.workspace_manager;
         workspaceManager.disconnect(this._updateWorkspacesId);
+        workspaceManager.disconnect(this._reorderWorkspacesId);
     }
 
     startSwipeScroll() {